<template>
  <div class="left-container">
    <h3>Left 组件</h3>
    <hr>

    <p>count 值：{{count}}---{{name}}</p>
    <button @click="btn" class="btn btn-primary">+1</button>
  </div>
</template>

<script>
// 按需导入 mapState
import {mapState} from 'vuex'

export default {
  name: 'Left',
  computed:{
    ...mapState(['count','name'])
  },
  methods:{
    btn(){
      this.$store.commit('add',{num:10,name:'biubui'})
    }
  }
}
</script>

<style>
</style>
